home *** CD-ROM | disk | FTP | other *** search
- On 02-Jan-98, Timo Engman smashed the keyboard with:
- >Hello.
-
- >I'm Timo Engman, and programming a new extension - which is called
- >"Second-Hand Extension", the current version is 0.01d6 but please, all
- >AMOSPro users - mail me and let me hear if I may add new commands to this
- >extension that the users want...For now, the extension have five commands
- >:-) pretty lame. But I learning how to program the graphics...
-
- >The extension uses slot 22 but mail me and I may change it to whatever.
- >Check the aminet/dev/amos/ for this extension...later...
- >Maybe I mail the .Lib file soon, to the Mailing List.
-
- I've added your extension to the extensionlist at my site, if you'd like to
- see what slots are used and for what you can always drop by :))
-
- ---
-
- >A Problem 1: How to return a string from a routine (and change it's
- >length) from it, the string is in the extension
-
- >dc.w TheLength
- >dc.b "TheString",0
- >even
-
- You need to ask for memory and then build the right structure, when looking
- at the string the first 2 bytes (word) holds the length of the string, then
- at the 3rd byte the string itselve starts. You can see this by trying to
- define a string in AMOS and then do a Deek(Varptr(W$)-2), that'll return
- the 'len'..
-
- Here's a way to do it:
- First you ask for the stringspace (needed length in both d3 & d0)
-
- ;Ask for string space...
- and.w #$FFFE,d3 * Only EVEN!
- addq.w #2,d3
- Rjsr L_Demande
- lea 2(a1,d3.w),a1
- move.l a1,HiChaine(a5)
- move.l a0,STa_d(pc) * Store adress
- move.w d0,(a0)+ * Store length
-
- Now the structure-adress of the new string is placed in a locale
- data-area to be returned to the caller, and the room for the string
- itselve is pointed by a0, be carefull not to swap these as they differs
- by 2 bytes !!!!..
- Then create the string with the first character starting in the adress
- pointed by a0, and end your procedure with:
-
- move.l STa_d(pc),d3 ;Stringadress
- moveq.l #2,d2 ;Returning a string
- rts
-
- (Remeber to clean up the stack BEFORE you put this, I'd forgotten once,
- and the same bug can be found in the IO_devices 2.0)
-
- That should return the string to the caller..
-
- ---
-
- >Problem 2: How to get a pointer from the extension in assembler,
- >typically i want the pointer for a variable, same as Varptr(variable) and
- >pointer for an array, same as Varptr(var(array))
-
- I havn't got a clue, I've been looking for a solve for the same problem
- some time. I think it's hidden somewhere in the include files that
- comes with AMOSPro.. Unfortunaly they're not very well documented..
-
- ---
-
- >Hope that all peoples understanding my bad english (I'm swedish)...And
- >those people who don't like the assembler language.
-
- And I'm danish, so that isn't much better :)
-
- --
- Happy greetings, Yours..
- __________________________________________________________________________
- /_ __/ __ / __ /\ ___\ __ \__ _\ aka. JENS VANG PETERSEN
- / / / /_/ / ____/ \ \___\ __ \ \ \ Nyvej 8, DK-4450 Jyderup, Denmark
- /_/ /_____/_/ \_____\_\ \_\ \_\ top_cat@post8.tele.dk
- --------------------------------------------------------------------------
- http://home8.inet.tele.dk/top_cat/
- -*- Home of 'The Ultimate Extension list' for AMOS TC & AMOS PRO -*-
- -*- AMOS Ring - AMIGA Ring - AQUA Ring -*-
- --------------------------------------------------------------------------
- Foolproof operation = All parameters are hard coded.
- --------------------------------------------------------------------------
-
-
-